using System.Linq;
using System.Collections.Generic;
namespace TaleGeneratorModel
{
	partial class TaleClasses
	{
		public IEnumerable<ViewFrameExample> GetViewFrameExample()
		{
			return ExecuteQuery<ViewFrameExample>("SELECT Slot.Name, Slot.ID AS SlotID, Frame.ID, DValues.ID AS ValueID, Slot.Inheritance, DValues.Value"+
                     "FROM Slot INNER JOIN"+
                         "DomainsValues ON Slot.DefaultValue = DomainsValues.ID INNER JOIN"+
                         "DValues ON DomainsValues.Value = DValues.ID INNER JOIN"+
                         "Frame ON DValues.Value = Frame.Name");
		}

        public IEnumerable<ViewDomains> GetViewDomains()
        {
            return ExecuteQuery<ViewDomains>("SELECT Domains.Name, DomainsValues.DomID, DomainsValues.Number, DValues.Value, DValues.ID" +
                    "FROM Domains INNER JOIN" +
                         "DomainsValues ON Domains.ID = DomainsValues.DomID INNER JOIN" +
                         "DValues ON DomainsValues.Value = DValues.ID");
        }

        public IEnumerable<ViewLog> GetViewLog()
        {
            return ExecuteQuery<ViewLog>("SELECT Frame.Name AS FrameName, Slot.Name, DValues.Value, [Log].Success"+
                    "FROM Frame INNER JOIN"+
                         "Slot INNER JOIN"+
                         "[Log] INNER JOIN"+
                         "DValues ON [Log].ValueID = DValues.ID"+
                        "ON Slot.ID = [Log].SlotID ON Frame.ID = Slot.FrameID");
        }

        public IEnumerable<ViewProductions> GetViewProductions()
        {
            return ExecuteQuery<ViewProductions>("SELECT TOP (100) PERCENT Fact.ID, Fact.SlotID, Fact.ValueID, Fact.Negation, Fact.CompSlotID, ProductionFact.ProductionID,"+
                         "ProductionFact.Type, ProductionFact.Number, Fact.Place"+
                            "FROM Fact INNER JOIN"+
                             "ProductionFact ON Fact.ID = ProductionFact.FactID"+
                                "ORDER BY ProductionFact.Number, ProductionFact.Type");
        }

        public IEnumerable<ViewSlotFrame> GetViewSlotFrame()
        {
            return ExecuteQuery<ViewSlotFrame>("SELECT Slot.ID, Slot.Name, Frame.ID AS FrameID, Frame.Is_a, Slot.Inheritance, Slot.Number"+
                        "FROM Slot INNER JOIN"+
                         "Frame ON Slot.FrameID = Frame.ID");
        }

        public IEnumerable<ViewValues> GetViewSlotValues()
        {
            return ExecuteQuery<ViewValues>("SELECT Frame.Name AS FrameName, Slot.Name, DValues.Value, Frame.ID AS FrameID, Slot.Number, SlotValues.ValueID"+
                        "FROM SlotValues INNER JOIN"+
                         "DValues ON SlotValues.ValueID = DValues.ID INNER JOIN"+
                         "Slot ON SlotValues.SlotID = Slot.ID INNER JOIN"+
                         "Frame ON Slot.FrameID = Frame.ID");
        }
	}
}
